<script setup>
defineProps({
  // coverImageUrl: {
  //   type: String,
  //   required: true
  // },
  id: {
    type: String,
    required: true
  },
  title: {
    type: String,
    required: true
  },
  // authorAvatarUrl: {
  //   type: String,
  //   required: true
  // },
  authorName: {
    type: String,
    required: true
  },
  likes: {
    type: Number,
    required: true
  }
})
</script>

<template>
  <div class="post">
    <!-- 大封面图 -->
    <div class="cover-image">
      <img src="../../../assets/show2.jpg" alt="Cover Image" />
    </div>
    <!-- 标题 -->
    <div class="titleCon">
      <div class="title">{{ title }}</div>
    </div>
    <!-- 作者信息和点赞数 -->
    <div class="footer">
      <div class="author">
        <img
          src="../../../assets/show1.png"
          alt="Author Avatar"
          class="avatar"
        />
        <div class="author-name">{{ authorName }}</div>
      </div>
      <div class="likes">
        <div>{{ likes }} ❤</div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.post {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  margin: 16px 16px;
  background-color: #fff;
  /* height: 280px; */
  width: 210px;
}

.cover-image img {
  width: 100%;
  height: 150px;
}

.titleCon {
  padding: 0px 10px;
  height: 30px;
  width: 180px;
  .title {
    display: flex;
    align-items: center;
    height: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--color-primary-label);
  }
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0px 10px;
  /* border-top: 1px solid #ddd; */
  margin-bottom: 5px;
}

.author {
  display: flex;
  align-items: center;
  .author-name {
    font-size: 10px;
  }
  .avatar {
    width: auto;
    height: 25px;
    border-radius: 50%;
    margin-right: 8px;
  }
}

.likes {
  font-size: 11px;
  color: #666;
}
</style>
